package com.my.algorithmlearning.entity;

import java.util.Arrays;

/**
 * @ClassName Child2
 * @Description Child2
 * @Author wanghaiwei
 * @Date 2022/11/14 11:10
 */

class Child2 extends Parent<String> {
    @Override
    public void setValue(String value) {
        System.out.println("Child2.setValue called");
        super.setValue(value);
    }

    public static void main(String[] args) {
        Child2 child2 = new Child2();
        Arrays.stream(child2.getClass().getMethods())
                .filter(method -> method.getName().equals("setValue"))
                .forEach(method -> {
                    try {
                        System.out.println(method.getDeclaringClass().getName() + "是否桥接方法: " + method.isBridge());
                        method.invoke(child2, "test");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });
        System.out.println(child2.toString());
    }
}
